
package com.shop.cloud.mall.admin.controller;

import com.shop.cloud.common.core.util.R;
import com.shop.cloud.mall.admin.service.UserPointsService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 用户积分
 *
 * @author
 * @date 2023-11-23 10:28:55
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/userpoints")
@Tag(description = "userpoints", name = "用户积分管理")
public class UserPointsController {

    private final UserPointsService userPointsService;

    /**
     * 用户积分查询
     * @param userId
     * @return R
     */
    @Operation(summary = "用户积分查询")
    @GetMapping("/{userId}")
    @PreAuthorize("@ato.hasAuthority('mall:userinfo:get')")
    public R getById(@PathVariable("userId") String userId) {
        return R.ok(userPointsService.getById(userId));
    }

}
